﻿using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.ZH.Dto;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.ZH
{
    /// <summary>
    ///  综合类流程报表 接口
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/zh")]
    public class ZHController : BPMReportPlatformController
    {
        private readonly IZHService _zhService;

        public ZHController(IZHService zhService)
        {
            _zhService = zhService;
        }

        /// <summary>
        /// 生产单更改审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("POCAP/GetAllAsync")]
        public async Task<PagedResultDto<GetPOCAPOutput>> GetAllAsync([FromBody] GetPOCAPInput input)
        {
            return await _zhService.GetAllAsync(input);
        }

        /// <summary>
        ///  生产单更改审批流程  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("POCAP/ExportAsync")]
        public async Task<XlsxFileResult<GetPOCAPOutput>> ExportAsync([FromBody] GetPOCAPInput input)
        {
            var rst = await _zhService.ExportAsync(input);
            return new XlsxFileResult<GetPOCAPOutput>(rst, "导出Excel");
        }


        /// <summary>
        /// 生产单更改审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("POCAP/GetPWSCodeAllAsync")]
        public async Task<PagedResultDto<GetPWSCodePOCAPOutput>> GetPWSCodeAllAsync([FromBody] GetPOCAPInput input)
        {
            return await _zhService.GetPWSCodeAllAsync(input);
        }

        /// <summary>
        ///  生产单更改审批流程  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("POCAP/ExportPWSCodeAsync")]
        public async Task<XlsxFileResult<GetPWSCodePOCAPOutput>> ExportPWSCodeAsync([FromBody] GetPOCAPInput input)
        {
            var rst = await _zhService.ExportPWSCodeAsync(input);
            return new XlsxFileResult<GetPWSCodePOCAPOutput>(rst, "导出Excel");
        }

        /// <summary>
        /// TU产地变更申请审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TUDCBGSQ/GetAllAsync")]
        public async Task<PagedResultDto<GetTUDCBGSQOutput>> GetAllAsync([FromBody] GetTUDCBGSQInput input)
        {
            return await _zhService.GetAllAsync(input);
        }

        /// <summary>
        ///  TU产地变更申请审批流程  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TUDCBGSQ/ExportAsync")]
        public async Task<XlsxFileResult<GetTUDCBGSQOutput>> ExportAsync([FromBody] GetTUDCBGSQInput input)
        {
            var rst = await _zhService.ExportAsync(input);
            return new XlsxFileResult<GetTUDCBGSQOutput>(rst, "导出Excel");
        }

        /// <summary>
        /// IU分析委托流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("IUFXWTLC/GetAllAsync")]
        public async Task<PagedResultDto<GetIUFXWTLCOutput>> GetAllAsync([FromBody] GetIUFXWTLCInput input)
        {
            return await _zhService.GetAllAsync(input);
        }

        /// <summary>
        ///  IU分析委托流程  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("IUFXWTLC/ExportAsync")]
        public async Task<XlsxFileResult<GetIUFXWTLCOutput>> ExportAsync([FromBody] GetIUFXWTLCInput input)
        {
            var rst = await _zhService.ExportAsync(input);
            return new XlsxFileResult<GetIUFXWTLCOutput>(rst, "导出Excel");
        }
    }
}